﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:Interactivity="clr-namespace:Microsoft.Practices.Prism.Interactivity;assembly=Microsoft.Practices.Prism.Interactivity"
    xmlns:vm="clr-namespace:Sample.ViewModels;assembly=Sample.ViewModels.WP8"
    xmlns:InteractionRequest="clr-namespace:Microsoft.Practices.Prism.Interactivity.InteractionRequest;assembly=Microsoft.Practices.Prism.Interactivity"
    xmlns:wi="clr-namespace:WP8.Interactivity"
    x:Class="WP8.Views.Validation"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True">
	<i:Interaction.Triggers>
		<i:EventTrigger EventName="PropertyChanged" SourceObject="{Binding AlertMessage, Mode=OneWay}">
            <wi:AlertAction Message="{Binding AlertMessage.Value}" />
		</i:EventTrigger>
	</i:Interaction.Triggers>
    <phone:PhoneApplicationPage.DataContext>
        <vm:ValidationViewModel />
    </phone:PhoneApplicationPage.DataContext>
	<!--LayoutRoot は、すべてのページ コンテンツが配置されるルート グリッドです-->
	<Grid x:Name="LayoutRoot" Background="Transparent">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<!--TitlePanel は、アプリケーション名とページ タイトルを格納します-->
		<StackPanel Grid.Row="0" Margin="12,17,0,28">
			<TextBlock x:Name="ApplicationTitle" Text="Validation" Style="{StaticResource PhoneTextNormalStyle}"/>
		</StackPanel>

        <!--ContentPanel - 追加コンテンツをここに入力します-->
		<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
			<StackPanel Grid.Row="1">
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition />
						<ColumnDefinition />
					</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
						<RowDefinition />
						<RowDefinition />
						<RowDefinition />
						<RowDefinition />
					</Grid.RowDefinitions>
					<!-- INotifyDataErrorInfo validation set ValidatesOnNotifyDataErrors=True -->
					<TextBlock Grid.Column="0" Grid.Row="1">
						<Run Text="All Upper"/>
					</TextBlock>
					<TextBox  Grid.Column="1" Grid.Row="1"
						Text="{Binding ValidationData.Value, Mode=TwoWay, ValidatesOnDataErrors=True}"/>
					<TextBlock Grid.Column="0" Grid.Row="2">
						<Run Text="Empty(Delay 3sec)"/>
					</TextBlock>
					<TextBox  Grid.Column="1" Grid.Row="2"
						Text="{Binding ValidationNotify.Value, Mode=TwoWay, ValidatesOnNotifyDataErrors=True}"/>
					<TextBlock Grid.Column="0" Grid.Row="3">
						<Run Text="All Lower, Length 5"/>
					</TextBlock>
					<TextBox  Grid.Column="1" Grid.Row="3"
						Text="{Binding ValidationBoth.Value, Mode=TwoWay, ValidatesOnNotifyDataErrors=True, ValidatesOnDataErrors=True}"/>
				</Grid>
				<TextBlock Text="{Binding ErrorInfo.Value}" Foreground="Red" />
				<Button Command="{Binding NextCommand}" Content="Next"/>
			</StackPanel>

		</Grid>
	</Grid>

</phone:PhoneApplicationPage>